package com.hksj.cm.controller;


import com.hksj.base.query.DeviceOverviewQuery;
import com.hksj.base.vo.DeviceOverviewVO;
import com.hksj.cm.dto.ClLargeScreenDTO;
import com.hksj.cm.service.ClLargeScreenService;
import com.hksj.cm.vo.*;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@Api(tags = "洁净度大屏管理")
@RestController
@RequestMapping("/api/clLargeScreen")
public class ClLargeScreenController {

    @Autowired
    private ClLargeScreenService clLargeScreenService;

    @ApiOperation(value = "大屏-查询洁净度级别占比")
    @PostMapping("/queryCleanLevelDist")
    public Rest<List<CleanLevelDistVO>> queryCleanLevelDist(@RequestBody ClLargeScreenDTO dto) {
        return Rest.ok(clLargeScreenService.queryCleanLevelDist(dto));
    }

    @ApiOperation("大屏-洁净度房间/位置排名(前五)")
    @PostMapping("/queryCleanLevelRank")
    public Rest<List<CleanLevelRankVO>> queryCleanLevelRank(@RequestBody ClLargeScreenDTO dto) {
        return Rest.ok(clLargeScreenService.queryCleanLevelRank(dto));
    }

    @ApiOperation("洁净度日历(最近30天)")
    @PostMapping("/queryCleanLevelCalendar")
    public Rest<List<CleanLevelCalendarVO>> queryCleanLevelCalendar(@RequestBody ClLargeScreenDTO dto) {
        return Rest.ok(clLargeScreenService.queryCleanLevelCalendar(dto));
    }

    @ApiOperation("设备概览")
    @PostMapping("/eqOverviewList")
    public Rest<Map<String, Object>> eqOverviewList(@RequestBody DeviceOverviewQuery dto) {
        Map<String, Object> map = clLargeScreenService.eqOverviewList(dto);
        return Rest.ok(map);
    }


    @ApiOperation("查看所有设备列表")
    @PostMapping("/deviceList")
    public Rest<List<DeviceVO>> deviceList(@RequestBody ClLargeScreenDTO dto) {
        List<DeviceVO> list = clLargeScreenService.deviceList(dto);
        return Rest.ok(list);
    }

}
